<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			html,
			body {
				height: 100%;
				margin: 0;
				padding: 0
			}
			
			ul,
			li {
				text-indent: 0;
				text-decoration: none;
				margin: 0;
				padding: 0
			}
			
			img {
				border: 0
			}
			
			body {
				background-color: #white;
				color: #999;
				font: 100%/18px helvetica, arial, sans-serif
			}
			
			canvas {
				cursor: crosshair;
				display: block;
				left: 0;
				position: absolute;
				top: 0;
				z-index: 20
			}
			/*<script type="text/javascript" src="js/jquery-2.0.0.min.js"></script>
<script type="text/javascript" src="js/texiao.js"></script>*/
			
			<style>.footer {
				position: absolute;
				bottom: 0;
				width: 100%;
				height: 100px;
				background-color: #ffc0cb;
			}
			
			.a2 {
				list-style-type: none;
				margin: 0;
				padding: 0;
				width: 120px;
				height: 500px;
				background-color: black
			}
			
			.a1 {
				display: block;
				color: #000;
				padding: 8px 16px;
				text-decoration: none;
			}
			/* 鼠标移动到选项上修改背景颜色 */
			
			.a1:hover {
				background-color: #555;
				color: white;
			}
			
			.footer {
				position: absolute;
				bottom: 0;
				width: 100%;
				height: 100px;
				background-color: #ffc0cb;
			}
		</style>

		<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

		<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
	</head>

	<body style="background: ) ;background-size:cover; ">
		<script type="text/javascript">
		</script>
	
		<div class="row">

			<div class="row clearfix">
				<div class="col-md-12 ">

				</div>
				<ol class="navbar navbar-inverse" id="info">

					<div class="col-md-7">
						<ul class="nav nav-tabs">
							
							<li role="presentation" class="active">
								<a href="#">视频</a>
								
							</li>
							<li role="presentation">
								<a href="#">热搜</a>
							</li>
							<li role="presentation">
								<a href="#">收藏</a>
							</li>
							<li role="presentation">
								<a href="#">空间</a>
							</li>
							<li role="presentation">
								<a href="#">分类</a>
							</li>
							<li role="presentation">
								<li role="presentation">
									<a href="#">空间</a>
								</li>
								<li role="presentation">
									<a href="#">换肤</a>
								</li>
                               <i>
								<marquee><a align="center" 
									style="color: red;font-size: x-large;" >
									这个世界很酷~</a></marquee></i>
						</ul>
						
					</div>

					<!--  -->

					<div class="col-md-5">
						<ul class="nav nav-tabs">
							<li>
								<a>
									<img src="images/定位.jpg" height="20px" width="20px"> 大连[切换]
								</a>
							</li>

							<li role="presentation">
								<a>
									<img src="images/语言.jpg" width="20px" height="20px" />
									<select name="language">
										<option value="">language</option>
										<option value="">中文</option>
										<option value="">英语</option>
										<option value="">西班牙语</option>
										<option value="">俄罗斯语</option>
										<option value="">孟加拉语</option>
										<option value="">阿拉伯语</option>
										<option value="">印度语</option>
										<option value="">日语</option>
										<option value="">法语</option>
										<option value="">德语</option>
										<option value="">点击查看更多语言</option>
									</select>
								</a>
							</li>
							<li role="presentation">
								<a href="#">客服</a>
							</li>
 				<li>
									<?php
		 if (isset($_GET["msg"])) {
		  echo $_GET["msg"];
		}
	   ?>
								
								 <?php 
       session_start();
       if(!isset($_SESSION["user"])){
        ?>
        <li><a href="/final_project/login/login.html" data-toggle="modal" data-target="#login">登录</a></li>
        <li><a href="/final_project/login/register.html" data-toggle="modal" data-target="#reg">注册</a></li>
        <?php        
       }else{
      ?>
      <li><a href="/final_project/login/login.html">欢迎【<?php echo $_SESSION["user"];?>】</a></li>
      <li><a href="qt_logout.php">注销</a></li>
      <li><a href="myCommentList.php" >我的评价</a></li>
     
      <?php
        }
    ?>
								
							</li>
						</ul>

					</div>

			</div>
		</div>
		</div>
		<!-- 主题内容-->
		<a style="color:red">提示：无聊的时候可以玩一玩休闲小游戏奥： </a>&nbsp;&nbsp;
		<a href="剪刀石头布.html">剪刀石头布</a>
		&nbsp;&nbsp;
		<a href="俄罗斯方块.html">俄罗斯小方块</a>
		<!-- 网页主题内容 -->

		<div class="row" style="background-color:#FDF7F7" >
			<div class="col-md-12" style="color: red">
			<div class="col-md-4">
			<p>按地区/时间</p>
			<p>
				<a href="#">国产</a>&nbsp; <a href="#">日本</a>&nbsp; <a href="#">欧美</a>&nbsp;
				<a href="#">其他</a>&nbsp;<br> <a href="#">2019</a>&nbsp; <a
					href="#">2018</a>&nbsp; <a href="#">2017</a>&nbsp; <a href="#">.....</a>&nbsp;
			</p>
		</div>
		<div class="col-md-4">
			<p>类型</p>
			<p>
				<a href="#">热血</a>&nbsp; <a href="#">搞笑</a>&nbsp; <a href="#">青春</a>&nbsp;
				<a href="#">电影</a>&nbsp; <a href="#">直播</a>&nbsp; <a href="#">教育</a>&nbsp;
				<a href="#">综艺</a>&nbsp; <a href="#">音乐</a>&nbsp; <a href="#">游戏</a>&nbsp;
				<a href="#">动漫</a>&nbsp; <a href="#">汽车</a>&nbsp; <a href="#">VR</a>&nbsp;
				<a href="#">娱乐</a>&nbsp; <a href="#">公益</a>&nbsp; <a href="#">资讯</a>&nbsp;
				<a href="#">生活</a>&nbsp; <a href="#">科技</a>&nbsp; <a href="#">财经</a>&nbsp;
				<a href="#">少儿</a>&nbsp; <a href="#">体育</a>&nbsp; <a href="#">时尚</a>&nbsp;
				<a href="#">来疯</a>&nbsp; <a href="#">其他</a>&nbsp;
			</p>
		</div>
		<div class="col-md-4">
			<p>按语言</p>
			<p>
				<a href="#">日语</a>&nbsp; <a href="#">国语</a>&nbsp; <a href="#">粤语</a>&nbsp;
				<a href="#">英语</a>&nbsp;<br> <a href="#">韩语</a>&nbsp; <a
					href="#">方言</a>&nbsp; <a href="#">其他</a>&nbsp;
			</p>
		</div>
		</div>
		</div>
		
		<!-- 搜索开始 -->
			<div class="row" style="background-color:#FDF7F7" >
		&nbsp;&nbsp;&nbsp;&nbsp;<?php
			require_once('head.php');
			?>
		
		</div>
		  <!-- 搜索 engding -->
<?php

 include_once('dbConn.php');
  //连接数据库		
  connect();
 //类型id是通过GET方法提交的   
 //根据类型id从数据库中查询属于该类型的所有视频信息
   $tid = $_GET['tid'];
   $sql0="select * from videotype where tid=$tid";
   $result0 = mysql_query($sql0) or die('查询失败！'.mysql_error());   
   $row0 = mysql_fetch_assoc($result0);
   $sql = "select * from videos where tid={$tid}";   
   $result = mysql_query($sql) or die('查询失败！'.mysql_error());   
  //获取指定的页码
  //判断是否指定第几页，如果没有指定，则显示第1页。
	if(!isset($_GET["page"]))
	$page=1;
	else{
		$page=$_GET["page"];
	}
  //获取总行数，用于计算分几页显示
  $result = mysql_query($sql);
  $totalrows = mysql_num_rows($result);
  //定义每页显示的行数
  $rowsperpage =8;
  //计算从表中第几行开始输出
  $start = ($page-1) * $rowsperpage;
  //查询用户，从第$start行开始，共查询$rowsperpage行。
  $sql .= " limit {$start}, {$rowsperpage}";
  //echo $sql.'<br/>';
  //执行sql语句
  $result = mysql_query($sql) or die('查询失败！'.mysql_error());  
   //查询该类型下的下载排行信息
   $sql1 = "select * from videos where tid={$tid} order by downtimes desc  limit 4";   
   $result1 = mysql_query($sql1) or die('查询失败！'.mysql_error());   
?>

<div class="row">
                    <h2 align="center"><?php
                    echo $row0["typename"];
                    ?>专栏</h2>
                    <ul class="list-inline row text-center">
                      <?php
                      while($row=mysql_fetch_assoc($result))
					  {
                      ?>
                        <div class="col-xs-12 col-lg-3" align="center">
                            <img src="/final_project/foreground_system/lite/images/<?php
                            echo $row["pic"];
                            ?>" class="responsive img-circle" width="120x120" heiht="80x80"/>

                            <p><a href="show.php?vid=<?php
                            echo $row["vid"];
                            ?>"><?php
                            echo $row["videoname"];
                            ?></a>
                            </p>
                        </div>
					<?php
					  }
					?>
					</ul>
                    <nav class="text-center">
<?php
//计算总页数。如果每页显示的行数>总行数，则只有1页，否则，页数=总行数/每页行数，上取整
  if($rowsperpage >= $totalrows)
      $totalpages = 1;
  else{	  
	  $totalpages = ceil($totalrows / $rowsperpage);
  }
  //如果不是第1页，则显示第一页和上一页的超链接，否则只显示文字
  if($page>1){
	  $first = "<a href=?page=1&tid=$tid>首页</a>";
	  $pre = "<a href=?tid=$tid&page=".($page-1).">上一页</a>";
  }else{
	  $first = '首页';
	  $pre = '上一页';
  }
  //如果不是最后一页，则显示下一页和最后一页的超链接，否则只显示文字
  if($page<$totalpages){
	  $last = "<a href=?tid=$tid&page=$totalpages>尾页</a>";
	  $next = "<a href=?tid=$tid&page=".($page+1).">下一页</a>";
  }else{
	  $last = '尾页';
	  $next = '下一页';
  }
  //输出分页
  echo "共{$totalrows}条记录&nbsp;&nbsp;";
  echo "$first"."&nbsp;&nbsp;";
  echo "$pre"."&nbsp;&nbsp;";
  for($i=1;$i<=$totalpages;$i++) 
		echo "<a href=?tid=$tid&page=$i>第{$i}页</a>&nbsp;&nbsp;";
  echo "$next"."&nbsp;&nbsp;";
  echo "$last";
  ?>
  </nav>
  </div>
 
  
  
  
<div class="list-group text-center"  id="sidebar">
                <h2 style="color:black;">下载排行</h2>
                <ul class="list-inline row text-center">
					<?php
                      while($row1=mysql_fetch_assoc($result1))
					  {
                      ?>
                    <li class="col-xs-12 col-lg-3">
                       <img src="/final_project/foreground_system/lite/images/<?php
                            echo $row1["pic"];
                            ?>" class="responsive img-circle" width="120x120" heiht="80x80"/>
                            <p><a href="show.php?vid=<?php
                            echo $row1["vid"];
                            ?>"><?php
                            echo $row1["videoname"];
                            ?></a>
                            </p>
                        </p>
                    </li>
                   <?php
					  }
					?>
                </ul>
            </div>




		<!--
        	作者：1161105403@qq.com
        	时间：2019-03-13
        	描述：
        	
        	导航开始
        -->

	

			<!--
        	作者：1161105403@qq.com
        	时间：2019-03-13
        	描述：
        	
        	ending
        -->
			
	</body>

</html>